/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "nha_hang", catalog = "quan_ly_nha_hang_tiec_cuoi", schema = "public")
@NamedQueries({
    @NamedQuery(name = "NhaHang.findAll", query = "SELECT n FROM NhaHang n"),
    @NamedQuery(name = "NhaHang.findByTenNhaHang", query = "SELECT n FROM NhaHang n WHERE n.tenNhaHang = :tenNhaHang"),
    @NamedQuery(name = "NhaHang.findByDiaChi", query = "SELECT n FROM NhaHang n WHERE n.diaChi = :diaChi"),
    @NamedQuery(name = "NhaHang.findBySdt", query = "SELECT n FROM NhaHang n WHERE n.sdt = :sdt"),
    @NamedQuery(name = "NhaHang.findByEmail", query = "SELECT n FROM NhaHang n WHERE n.email = :email"),
    @NamedQuery(name = "NhaHang.findByTrangThai", query = "SELECT n FROM NhaHang n WHERE n.trangThai = :trangThai"),
    @NamedQuery(name = "NhaHang.findByMaNhaHang", query = "SELECT n FROM NhaHang n WHERE n.maNhaHang = :maNhaHang")})
public class NhaHang implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Column(name = "ten_nha_hang")
    private String tenNhaHang;
    @Column(name = "dia_chi")
    private String diaChi;
    @Column(name = "sdt")
    private String sdt;
    @Column(name = "email")
    private String email;
    @Column(name = "trang_thai")
    private Integer trangThai;
    @Id
    @Basic(optional = false)
    @Column(name = "ma_nha_hang")
    private String maNhaHang;

    public NhaHang() {
    }

    public NhaHang(String maNhaHang) {
        this.maNhaHang = maNhaHang;
    }

    public String getTenNhaHang() {
        return tenNhaHang;
    }

    public void setTenNhaHang(String tenNhaHang) {
        String oldTenNhaHang = this.tenNhaHang;
        this.tenNhaHang = tenNhaHang;
        changeSupport.firePropertyChange("tenNhaHang", oldTenNhaHang, tenNhaHang);
    }

    public String getDiaChi() {
        return diaChi;
    }

    public void setDiaChi(String diaChi) {
        String oldDiaChi = this.diaChi;
        this.diaChi = diaChi;
        changeSupport.firePropertyChange("diaChi", oldDiaChi, diaChi);
    }

    public String getSdt() {
        return sdt;
    }

    public void setSdt(String sdt) {
        String oldSdt = this.sdt;
        this.sdt = sdt;
        changeSupport.firePropertyChange("sdt", oldSdt, sdt);
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        String oldEmail = this.email;
        this.email = email;
        changeSupport.firePropertyChange("email", oldEmail, email);
    }

    public Integer getTrangThai() {
        return trangThai;
    }

    public void setTrangThai(Integer trangThai) {
        Integer oldTrangThai = this.trangThai;
        this.trangThai = trangThai;
        changeSupport.firePropertyChange("trangThai", oldTrangThai, trangThai);
    }

    public String getMaNhaHang() {
        return maNhaHang;
    }

    public void setMaNhaHang(String maNhaHang) {
        String oldMaNhaHang = this.maNhaHang;
        this.maNhaHang = maNhaHang;
        changeSupport.firePropertyChange("maNhaHang", oldMaNhaHang, maNhaHang);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maNhaHang != null ? maNhaHang.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NhaHang)) {
            return false;
        }
        NhaHang other = (NhaHang) object;
        if ((this.maNhaHang == null && other.maNhaHang != null) || (this.maNhaHang != null && !this.maNhaHang.equals(other.maNhaHang))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "GUI.NhaHang[ maNhaHang=" + maNhaHang + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
